<template>
	<view class="Body">
		<div class="Main Site" style="overflow: visible;">
			<div class="van-nav-bar van-nav-bar--fixed">
				<div class="van-nav-bar__content">
					<div class="van-nav-bar__left"><i
							class="van-icon van-icon-arrow-left van-nav-bar__arrow"><!----></i></div>
					<div class="van-nav-bar__title van-ellipsis"></div>
				</div>
			</div>
			
			
			
			<div class="Site PageBox">
				<div class="van-nav-bar van-nav-bar--fixed">
					<div class="van-nav-bar__content">
						<div class="van-nav-bar__left" @click="back"><i
								class="van-icon van-icon-arrow-left van-nav-bar__arrow" style="color: #fff;font-size: 32rpx;"><!----></i></div>
						<div class="van-nav-bar__title van-ellipsis" style="color: #fff !;margin-left: 56rpx;">{{common.common4[0]}}</div>
					</div>
				</div>
				<view class="new-list">
					<view class="new-top">
						<view class="new-top-title">
							{{common.sell.label[0]}}:{{userinfo.money}} USDT
						</view>
						<view class="new-title1">
							 {{common.wallet.default[22]}}
						</view>
						<view class="new-title1">
							{{(userinfo.money * userinfo.baobl).toFixed(2)}} USDT
						</view>
					</view>
					<view class="new-item">
						<!-- <image style="width: 110rpx;height: 108rpx;" src="../../static/image/my/sc1.png" mode=""></image> -->
						<u-upload :custom-btn="true" :fileList="fileList" @on-success="okopen" multiple :maxCount="1" :uploadText="common.wallet.default[18]" >
							<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
							<image style="width: 110rpx;height: 108rpx;" src="../../static/image/my/sc1.png" mode=""></image>
							</view>
						</u-upload>
						<text>{{common.newBind[0]}}</text>
					</view>
					<view class="new-item">
						<u-upload :custom-btn="true" :fileList="fileList1" @on-success="okopen1" multiple :maxCount="1" :uploadText="common.common4[5]" >
							<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
							<image style="width: 110rpx;height: 108rpx;" src="../../static/image/my/sc2.png" mode=""></image>
							</view>
						</u-upload>
						
						<text>{{common.newBind[1]}}</text>
					</view>
					<view class="new-item">
						<u-upload :custom-btn="true" :fileList="fileList2" @on-success="okopen2" multiple :maxCount="1" :uploadText="common.common4[5]"  >
							<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
							<image style="width: 110rpx;height: 108rpx;" src="../../static/image/my/sc3.png" mode=""></image>
							</view>
						</u-upload>
						<text>{{common.newBind[2]}}</text>
					</view>
					<view class="sum-btn" @click="tijiao">
						{{common.bindAccount.default[1]}}
					</view>
				</view>
				
				
				
				
				
				
				
				
			</div>
		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isshow: false,
				bankname:'',
				userinfo: [],
				realname:'',
				banknum:'',
				mobile:'',
				userinfo:[],
				fileList: [],
				fileurl:'',
				fileList1: [],
				fileurl1:'',
				fileList2: [],
				fileurl2:'',
				address:'',
				isbind:0
			};
		},
		onLoad(options) {
			const {
				id
			} = options
			this.id = id
			this.getuserinfo()
		},
		onShow() {
	
		},
		methods: {
			getuserinfo(){
				const token = uni.getStorageSync('token')
				let that = this
				this.$u.api.index.getUserinfo(token).then(res => {
					this.userinfo = res.data
					if(res.data.bank.length > 0){
						that.bankname = res.data.bank[0].bank_name
						that.realname = res.data.bank[0].name
						that.banknum = res.data.bank[0].card_no
						that.mobile = res.data.bank[0].bank_deposit
						that.isbind = 1
					}else{
						that.isbind = 0
					}
				})
				// const token = uni.getStorageSync('token')
				this.$u.api.index.cointype(token).then(res => {
					// this.cointype = res.data[0].coin_type
					this.address = res.data[0].caddre
				})
			},
			okopen(data){
				this.$utils.showToast(this.common.common3[0])
				this.fileurl = data.data.url
				console.log(data.data.url)
			},
			okopen1(data){
				this.$utils.showToast(this.common.common3[0])
				this.fileurl1 = data.data.url
				console.log(data.data.url)
			},
			okopen2(data){
				this.$utils.showToast(this.common.common3[0])
				this.fileurl2 = data.data.url
				console.log(data.data.url)
			},
			tijiao(){
				// if(this.isbind == 0){
					const token = uni.getStorageSync('token')
					this.$u.api.index.bind_real(token,this.fileurl,this.fileurl1,this.fileurl2).then(res => {
						this.$utils.showToast(res.msg)
					})
				// }else{
					// const token = uni.getStorageSync('token')
					// this.$u.api.index.updete_bank(token,this.realname,this.banknum,this.mobile,this.bankname,this.userinfo.bank[0].id).then(res => {
						// this.$utils.showToast(res.msg)
					// })
				// }
			},
			back() {
				// const pages = getCurrentPages();
				// if (pages.length === 2) {
				// 	uni.navigateBack({
				// 		delta: 1
				// 	});
				// } else if (pages.length === 1) {
					uni.switchTab({
						url: '/pages/index/index',
					})
				// } else {
				// 	uni.navigateBack({
				// 		delta: 1
				// 	});
				// }
			},
			dumprun(url) {
				uni.navigateTo({
					url
				})
			},
		},
		computed: {
			common() {
				return this.$t("common")
			},
		}
	}
</script>

<style lang="scss" scoped>
	.ScrollBox {
	    padding: 0 !important;
	}
	
	.Site .van-nav-bar .van-icon {
	  /*  font-size: 1.5rem !important;
	    color: #bbb !important; */
	}
	
	.PageBox {
	    color: #ccc;
		padding-top: 20px;
	    background-color: #2A2D34;
		overflow-y: scroll;
	}
	
	.PageBox .box {
	   /* width: 95%;
	    padding: 10px 0 10px 10px;
	    font-size: 13px;
	    margin-top: 15px;
	    border-radius: 10px;
	    margin-left: 10px;
	    background-color: #191c23;
	    color: #ccc */
	}
	
	.PageBox .tool:before {
		content: "";
		display: block;
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		top: -80%
	}
	
	.tool {
		border-radius: 10px;
		background-color: #0076fa;
		color: #fff;
		height: 120px;
		box-shadow: 0 1px 3px hsla(0, 0%, 85.9%, .8588235294117647);
		overflow: hidden;
		z-index: 99;
		padding: 0 5px;
		display: flex;
		align-items: center;
		padding: 20px
	}
	
	.van-nav-bar {
	    background-color: #1a1a1a
	}
	
	.van-divider {
	    margin: 0
	}
	
	.van-nav-bar .van-nav-bar__title {
	    color: #ccc
	}
	
	.PageBox .van-cell {
	    background-color: #191c23
	}
	
	.van-cell .van-cell__title {
	    font-size: 16px;
	    width: 130px;
	    color: #ccc
	}
	
	.van-uploader .van-uploader__preview,.van-uploader .van-uploader__preview-image,.van-uploader .van-uploader__upload {
	    margin: 0;
	    background-color: #f7f8fa;
	    border-radius: 8px
	}
	
	.van-field {
	    font-weight: 700
	}
	
	.btn {
	    width: 85%;
	    padding: 10px 50px;
	    border-radius: 20px;
	    background-color: #0076fa;
	    color: #000;
	    font-size: 16px;
	    text-align: center;
	    margin: 15px 30px 30px
	}
	
	.new-list{
		margin-top: 40px;
		padding: 16rpx 22rpx ;
		box-sizing: border-box;
		
	}
	.new-top{
		width: 708rpx;
		height: 194rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		background-image: url('../../static/image/my/txbj.png');
		background-size: 100% 100%;
		padding: 0 48rpx;
		padding-top: 32rpx;
		.new-top-title{
			font-family: Inter, Inter;
			font-weight: 400;
			font-size: 26rpx;
			color: #000000;
			padding-bottom: 18rpx;
			border-bottom: 1rpx solid #5EC9FD;
		}
		.new-title1{
			margin-top: 10rpx;
			font-family: Inter, Inter;
			font-weight: 400;
			font-size: 26rpx;
			color: #000000;
		}
		
		
	}
	.new-item{
		margin-top: 16rpx;
		width: 708rpx;
		height: 300rpx;
		background: #222328;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		text{
			margin-top: 42rpx;
			font-family: Inter, Inter;
			font-weight: 400;
			font-size: 26rpx;
			color: #FFFFFF;
		}
	}
	.sum-btn{
		width: 708rpx;
		height: 88rpx;
		background: #03E4DF;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		margin-top: 18rpx;
		text-align: center;
		line-height: 88rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		font-size: 32rpx;
		color: #111111;
	}
</style>